package lily.phs.healthedu;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.GridView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.AdapterView.OnItemClickListener;
import lily.phs.urh.R;

public class kaoqianfudao_item extends Activity {
	
	private Animation in_left;
	private Animation in_right;
	private Animation out_left;
	private Animation out_right;
	private TextView trainning_title;
	private TextView trainning_content;
	//private GridView gv;
	Button leftBtn;
	
	public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
        setContentView(R.layout.trainning_all);
        getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.i_title);
        
        out_left = AnimationUtils.loadAnimation(this,R.anim.anim_slide_out_left);
        out_right = AnimationUtils.loadAnimation(this,R.anim.anim_slide_out_right);
        in_right = AnimationUtils.loadAnimation(this, R.anim.anim_slide_in_right);
        in_left = AnimationUtils.loadAnimation(this,R.anim.anim_slide_in_left);
        trainning_title = (TextView)this.findViewById(R.id.trainning_title);
        trainning_content = (TextView)this.findViewById(R.id.trainning_content);
        leftBtn = (Button) findViewById(R.id.title_left_btn);
        final Button rightBtn = (Button) findViewById(R.id.title_right_btn);
        final Button rightBtn2 = (Button) findViewById(R.id.title_right_btn2);
        leftBtn.setText("后退");
        leftBtn.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				finish();
				overridePendingTransition(R.anim.anim_slide_in_left,R.anim.anim_slide_out_right);
			}
        	
        });
        rightBtn.setVisibility(View.GONE);
        rightBtn2.setVisibility(View.GONE);
        //TextView tv_TitleBar = (TextView)this.findViewById(R.id.tv_titlebar);
 

    	Bundle bd = getIntent().getExtras();
    	int child = bd.getInt("child");
    	int id = bd.getInt("id");
    	switch(child)
    	{
    	case 0:
    	    //tv_TitleBar.setText("中医执业助理医师考试大纲");
    		switch(id)
    		{
    		case 0:
        		trainning_title.setText(getResources().getString(R.string.kaoqianfudao_kaoshidagang_title1));
        		trainning_content.setText(getResources().getString(R.string.kaoqianfudao_kaoshidagang_content1));
    			break;
    		case 1:
        		trainning_title.setText(getResources().getString(R.string.kaoqianfudao_kaoshidagang_title2));
        		trainning_content.setText(getResources().getString(R.string.kaoqianfudao_kaoshidagang_content2));
    			break;
    		case 2:
        		trainning_title.setText(getResources().getString(R.string.kaoqianfudao_kaoshidagang_title3));
        		trainning_content.setText(getResources().getString(R.string.kaoqianfudao_kaoshidagang_content3));
    			break;
    		case 3:
        		trainning_title.setText(getResources().getString(R.string.kaoqianfudao_kaoshidagang_title4));
        		trainning_content.setText(getResources().getString(R.string.kaoqianfudao_kaoshidagang_content4));
    			break;
    		case 4:
        		trainning_title.setText(getResources().getString(R.string.kaoqianfudao_kaoshidagang_title5));
        		trainning_content.setText(getResources().getString(R.string.kaoqianfudao_kaoshidagang_content5));
    			break;
    		}
    		break;    		
    	case 1:
    	    //tv_TitleBar.setText("中医执业助理医师考试经验");
    		switch(id)
    		{
    		case 0:
        		trainning_title.setText(getResources().getString(R.string.kaoqianfudao_kaoshijingyan_title1));
        		trainning_content.setText(getResources().getString(R.string.kaoqianfudao_kaoshijingyan_content1));
    			break;
    		case 1:
        		trainning_title.setText(getResources().getString(R.string.kaoqianfudao_kaoshijingyan_title2));
        		trainning_content.setText(getResources().getString(R.string.kaoqianfudao_kaoshijingyan_content2));
    			break;
    		case 2:
        		trainning_title.setText(getResources().getString(R.string.kaoqianfudao_kaoshijingyan_title3));
        		trainning_content.setText(getResources().getString(R.string.kaoqianfudao_kaoshijingyan_content3));
    			break;
    		case 3:
        		trainning_title.setText(getResources().getString(R.string.kaoqianfudao_kaoshijingyan_title4));
        		trainning_content.setText(getResources().getString(R.string.kaoqianfudao_kaoshijingyan_content4));
    			break;
    		case 4:
        		trainning_title.setText(getResources().getString(R.string.kaoqianfudao_kaoshijingyan_title5));
        		trainning_content.setText(getResources().getString(R.string.kaoqianfudao_kaoshijingyan_content5));
    			break;
    		}
    		break;
    	case 2:
    	    //tv_TitleBar.setText("中医执业助理医师辅导精华");
    		switch(id)
    		{
    		case 0:
        		trainning_title.setText(getResources().getString(R.string.kaoqianfudao_fudaojinghua_title1));
        		trainning_content.setText(getResources().getString(R.string.kaoqianfudao_fudaojinghua_content1));
    			break;
    		case 1:
        		trainning_title.setText(getResources().getString(R.string.kaoqianfudao_fudaojinghua_title2));
        		trainning_content.setText(getResources().getString(R.string.kaoqianfudao_fudaojinghua_content2));
    			break;
    		case 2:
        		trainning_title.setText(getResources().getString(R.string.kaoqianfudao_fudaojinghua_title3));
        		trainning_content.setText(getResources().getString(R.string.kaoqianfudao_fudaojinghua_content3));
    			break;
    		case 3:
        		trainning_title.setText(getResources().getString(R.string.kaoqianfudao_fudaojinghua_title4));
        		trainning_content.setText(getResources().getString(R.string.kaoqianfudao_fudaojinghua_content4));
    			break;
    		case 4:
        		trainning_title.setText(getResources().getString(R.string.kaoqianfudao_fudaojinghua_title5));
        		trainning_content.setText(getResources().getString(R.string.kaoqianfudao_fudaojinghua_content5));
    			break;
    		}
    		break;
    	}
        

        
        //menubar
        /*gv = (GridView)this.findViewById(R.id.menu);
		String[] menubar = new String[]{"首页", "后退",  "帮助", "菜单"  };
		int[] menuIcon = new int[]{
				R.drawable.controlbar_homepage,
				R.drawable.controlbar_backward_enable,
				R.drawable.controlbar_window, 
				R.drawable.controlbar_showtype_list, };
		ArrayList<Map<String , Object>> gv_array = new ArrayList<Map<String , Object>>();
		for(int i=0;i<menubar.length;i++){
			Map<String , Object> gv_item = new HashMap<String , Object>();
			gv_item.put("menuIcon", menuIcon[i]);
			gv_item.put("menuOrder", menubar[i]);
			System.out.println("menuOrder="+menubar[i]);
			gv_array.add(gv_item);
			//System.out.println("gv_item="+gv_item.toString());
		}
		SimpleAdapter gvAdapter = new SimpleAdapter(kaoqianfudao_item.this, gv_array, R.layout.griditem, 
				new String[]{"menuIcon","menuOrder"}, 
				new int[]{R.id.gv_icon,R.id.gv_text});
		gv.setAdapter(gvAdapter);
		gv.setOnItemClickListener(new OnItemClickListener(){

			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,long arg3) {
				// TODO Auto-generated method stub
				switch(arg2){
				case 0:{//主界面
					startActivity(new Intent(kaoqianfudao_item.this,MainActivity.class));
					overridePendingTransition(R.anim.anim_slide_in_left,R.anim.anim_slide_out_right);
					finish();
					break;
				}
				case 1:{//back
					finish();
					overridePendingTransition(R.anim.anim_slide_in_left,R.anim.anim_slide_out_right);
					break;
				}
				case 2:{//
					
					break;
				}
				}
			}			
		});     */

        }
}